#include "webview.h"

WebView::WebView(QWidget *parent) :
	QWidget(parent),
	m_webView(new QWebView(this))
{
	QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
	m_webView->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
	connect(m_webView, SIGNAL(titleChanged(QString)), this, SLOT(emit_titleChanged(QString)));
	connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(emit_urlChanged(QUrl)));
	connect(m_webView, SIGNAL(iconChanged()), this, SLOT(emit_iconChanged()));
}
void WebView::loadUrl(QString url)
{
	m_webView->load(QUrl(url));
}
void WebView::showPage(TabItem *tab)
{
	currentTab = tab;
	m_webView->setPage(tab->page());
	m_webView->show();
}
void WebView::resizeEvent(QResizeEvent *event)
{
	m_webView->resize(event->size());
}
